package com.tianhao.luo;

import com.sun.corba.se.impl.orbutil.ObjectUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @ClassName: Soldier
 * @Description: 士兵
 * @author: tianhao.luo@hand-china.com
 * @date: 2020/7/7  10:16
 */
public class Soldier {
    private static final Logger LOGGER = LoggerFactory.getLogger(Soldier.class);

    /**
     * 枪的实例
     */
    AbstractGun gun;
    AbstractToy toy;

    public void setGun(AbstractGun gun) {
        this.gun = gun;
    }

    public void setToy(AbstractToy toy) {
        this.toy = toy;
    }

    public void killEnemy(){
        if (null != gun) {
            LOGGER.info("士兵各就位，准备杀敌");
            gun.model();
            gun.sound();
            gun.shoot();
        }
        if (null != toy) {
            LOGGER.info("玩具枪不用杀人");
            toy.model();
            toy.sound();
            toy.shoot();
        }
    }
}
